﻿
namespace NetROS.Tiers.Windows.Forms
{
	/// <summary>
	/// This is the abstract edit form for the <see cref="Entities.Banka"/> entity.
	/// </summary>
	/// <remarks>This class is overwritten by .netTiers at each generation.</remarks>
	[System.ComponentModel.DesignerCategoryAttribute("code")]
	public abstract class BankaEditControlBase : System.Windows.Forms.UserControl
	{
		#region Fields
		
		//private System.Windows.Forms.TableLayoutPanel uxTableLayoutPanel;
		/// <summary>
		/// The ErrorProvider for the Entity;
		/// </summary>
		protected System.Windows.Forms.ErrorProvider uxErrorProvider;
		
		/// <summary>
		/// The BindingSource for the entity.
		///</summary>
		protected System.Windows.Forms.BindingSource uxBindingSource;
						
		
		/// <summary>
		/// TextBox for the ID property. 
		/// </summary>
		protected System.Windows.Forms.TextBox uxID;
		
		/// <summary>
		/// The <see cref="System.Windows.Forms.Label"/> associated with the ID property.
		/// </summary>
		protected System.Windows.Forms.Label uxIDLabel;
		
		/// <summary>
		/// TextBox for the Naziv property. 
		/// </summary>
		protected System.Windows.Forms.TextBox uxNaziv;
		
		/// <summary>
		/// The <see cref="System.Windows.Forms.Label"/> associated with the Naziv property.
		/// </summary>
		protected System.Windows.Forms.Label uxNazivLabel;
		
		/// <summary>
		/// TextBox for the VodeciBrojDepozitneIstitucije property. 
		/// </summary>
		protected System.Windows.Forms.TextBox uxVodeciBrojDepozitneIstitucije;
		
		/// <summary>
		/// The <see cref="System.Windows.Forms.Label"/> associated with the VodeciBrojDepozitneIstitucije property.
		/// </summary>
		protected System.Windows.Forms.Label uxVodeciBrojDepozitneIstitucijeLabel;
		
		/// <summary>
		/// ComboBox for the IDMjesto property.
		/// </summary>
		protected System.Windows.Forms.ComboBox uxIDMjesto;
		
		/// <summary>
		/// The <see cref="System.Windows.Forms.Label"/> associated with the IDMjesto property.
		/// </summary>
		protected System.Windows.Forms.Label uxIDMjestoLabel;
		
		/// <summary>
		/// TextBox for the MB property. 
		/// </summary>
		protected System.Windows.Forms.TextBox uxMB;
		
		/// <summary>
		/// The <see cref="System.Windows.Forms.Label"/> associated with the MB property.
		/// </summary>
		protected System.Windows.Forms.Label uxMBLabel;
		
		/// <summary>
		/// TextBox for the MinimalniIznos property. 
		/// </summary>
		protected System.Windows.Forms.TextBox uxMinimalniIznos;
		
		/// <summary>
		/// The <see cref="System.Windows.Forms.Label"/> associated with the MinimalniIznos property.
		/// </summary>
		protected System.Windows.Forms.Label uxMinimalniIznosLabel;
		
		/// <summary>
		/// TextBox for the MaksimalniIznos property. 
		/// </summary>
		protected System.Windows.Forms.TextBox uxMaksimalniIznos;
		
		/// <summary>
		/// The <see cref="System.Windows.Forms.Label"/> associated with the MaksimalniIznos property.
		/// </summary>
		protected System.Windows.Forms.Label uxMaksimalniIznosLabel;
		
		/// <summary>
		/// TextBox for the MaksimalniBrojRata property. 
		/// </summary>
		protected System.Windows.Forms.TextBox uxMaksimalniBrojRata;
		
		/// <summary>
		/// The <see cref="System.Windows.Forms.Label"/> associated with the MaksimalniBrojRata property.
		/// </summary>
		protected System.Windows.Forms.Label uxMaksimalniBrojRataLabel;
		#endregion
		
		#region Main entity
		private Entities.Banka _Banka;
		/// <summary>
		/// Gets or sets the <see cref="Entities.Banka"/> entity to edit with this form.
		/// </summary>
		/// <value>The <see cref="Entities.Banka"/> instance.</value>
		public Entities.Banka Banka
		{
			get {return this._Banka;}
			set
			{
				this._Banka = value;
				if (value != null) 
				{
					this.uxBindingSource.DataSource = value;
					BindControls();
				}			
				
			}
		}
		#endregion
		
		/// <summary>
		/// Binds the controls.
		/// </summary>
		private void BindControls()
		{
			this.uxID.DataBindings.Clear();
			this.uxID.DataBindings.Add("Text", this.uxBindingSource, "ID", true, System.Windows.Forms.DataSourceUpdateMode.OnPropertyChanged);
			this.uxNaziv.DataBindings.Clear();
			this.uxNaziv.DataBindings.Add("Text", this.uxBindingSource, "Naziv", true, System.Windows.Forms.DataSourceUpdateMode.OnPropertyChanged);
			this.uxVodeciBrojDepozitneIstitucije.DataBindings.Clear();
			this.uxVodeciBrojDepozitneIstitucije.DataBindings.Add("Text", this.uxBindingSource, "VodeciBrojDepozitneIstitucije", true, System.Windows.Forms.DataSourceUpdateMode.OnPropertyChanged);
			this.uxIDMjesto.DataBindings.Clear();
			this.uxIDMjesto.DataBindings.Add("SelectedValue", this.uxBindingSource, "IDMjesto", true, System.Windows.Forms.DataSourceUpdateMode.OnPropertyChanged);
			this.uxMB.DataBindings.Clear();
			this.uxMB.DataBindings.Add("Text", this.uxBindingSource, "MB", true, System.Windows.Forms.DataSourceUpdateMode.OnPropertyChanged);
			this.uxMinimalniIznos.DataBindings.Clear();
			this.uxMinimalniIznos.DataBindings.Add("Text", this.uxBindingSource, "MinimalniIznos", true, System.Windows.Forms.DataSourceUpdateMode.OnPropertyChanged);
			this.uxMaksimalniIznos.DataBindings.Clear();
			this.uxMaksimalniIznos.DataBindings.Add("Text", this.uxBindingSource, "MaksimalniIznos", true, System.Windows.Forms.DataSourceUpdateMode.OnPropertyChanged);
			this.uxMaksimalniBrojRata.DataBindings.Clear();
			this.uxMaksimalniBrojRata.DataBindings.Add("Text", this.uxBindingSource, "MaksimalniBrojRata", true, System.Windows.Forms.DataSourceUpdateMode.OnPropertyChanged);
		}					
		
		#region Constructor
		
		/// <summary>
		/// Initializes a new instance of the <see cref="BankaEditControlBase"/> class.
		/// </summary>
		public BankaEditControlBase()
		{
			InitializeComponent();			
			
			this.uxBindingSource.CurrentItemChanged += new System.EventHandler(uxBindingSource_currentItemChanged);
		}		
		
		/// <summary>
		/// 
		/// </summary>
		private void uxBindingSource_currentItemChanged(object sender, System.EventArgs e)
		{
			if (_Banka != null) _Banka.Validate();
		}	
				
		/// <summary>
		/// Initializes the component.
		/// </summary>
		public void InitializeComponent()
		{
			this.components = new System.ComponentModel.Container();
			this.uxErrorProvider = new System.Windows.Forms.ErrorProvider(this.components);
			this.uxBindingSource = new System.Windows.Forms.BindingSource(this.components);
			
			//this.uxTableLayoutPanel = new System.Windows.Forms.TableLayoutPanel();
			this.uxID = new System.Windows.Forms.TextBox();
			uxIDLabel = new System.Windows.Forms.Label();
			this.uxNaziv = new System.Windows.Forms.TextBox();
			uxNazivLabel = new System.Windows.Forms.Label();
			this.uxVodeciBrojDepozitneIstitucije = new System.Windows.Forms.TextBox();
			uxVodeciBrojDepozitneIstitucijeLabel = new System.Windows.Forms.Label();
			this.uxIDMjesto = new System.Windows.Forms.ComboBox();
			uxIDMjestoLabel = new System.Windows.Forms.Label();
			this.uxMB = new System.Windows.Forms.TextBox();
			uxMBLabel = new System.Windows.Forms.Label();
			this.uxMinimalniIznos = new System.Windows.Forms.TextBox();
			uxMinimalniIznosLabel = new System.Windows.Forms.Label();
			this.uxMaksimalniIznos = new System.Windows.Forms.TextBox();
			uxMaksimalniIznosLabel = new System.Windows.Forms.Label();
			this.uxMaksimalniBrojRata = new System.Windows.Forms.TextBox();
			uxMaksimalniBrojRataLabel = new System.Windows.Forms.Label();
			
			((System.ComponentModel.ISupportInitialize)(this.uxBindingSource)).BeginInit();
			((System.ComponentModel.ISupportInitialize)(this.uxErrorProvider)).BeginInit();
			this.SuspendLayout();
			
			// 
			// uxTableLayoutPanel
			// 
			//this.uxTableLayoutPanel.AutoSize = true;
			//this.uxTableLayoutPanel.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink;
			//this.uxTableLayoutPanel.ColumnCount = 2;
			//this.uxTableLayoutPanel.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Absolute, 120F));
			//this.uxTableLayoutPanel.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Absolute, 250F));
			//this.uxTableLayoutPanel.Location = new System.Drawing.System.Drawing.Point(3, 3);
			//this.uxTableLayoutPanel.Name = "uxTableLayoutPanel";
			//this.uxTableLayoutPanel.RowCount = 2;
			//this.uxTableLayoutPanel.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 25F));
			//this.uxTableLayoutPanel.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 25F));
			//this.uxTableLayoutPanel.Size = new System.Drawing.Size(450, 50);
			//this.uxTableLayoutPanel.TabIndex = 0;
			
			//
			// uxErrorProvider
			//
			this.uxErrorProvider.ContainerControl = this;
			this.uxErrorProvider.DataSource = this.uxBindingSource;
			
			//
			// uxIDLabel
			//
			this.uxIDLabel.Text = "ID:";
			this.uxIDLabel.Location = new System.Drawing.Point(3, 0);
			this.Controls.Add(this.uxIDLabel);
			//this.uxTableLayoutPanel.Controls.Add(this.uxIDLabel);			
			//
			// uxID
			//
			this.uxID.ReadOnly = true;
			//this.uxTableLayoutPanel.Controls.Add(this.uxID);
			this.uxID.Location = new System.Drawing.Point(160, 0);
			this.Controls.Add(this.uxID);
			//
			// uxNazivLabel
			//
			this.uxNazivLabel.Text = "Naziv:";
			this.uxNazivLabel.Location = new System.Drawing.Point(3, 26);
			this.Controls.Add(this.uxNazivLabel);
			//this.uxTableLayoutPanel.Controls.Add(this.uxNazivLabel);			
			//
			// uxNaziv
			//
			this.uxNaziv.Width = 250;
			this.uxNaziv.MaxLength = 200;
			//this.uxTableLayoutPanel.Controls.Add(this.uxNaziv);
			this.uxNaziv.Location = new System.Drawing.Point(160, 26);
			this.Controls.Add(this.uxNaziv);
			//
			// uxVodeciBrojDepozitneIstitucijeLabel
			//
			this.uxVodeciBrojDepozitneIstitucijeLabel.Text = "VodeciBrojDepozitneIstitucije:";
			this.uxVodeciBrojDepozitneIstitucijeLabel.Location = new System.Drawing.Point(3, 52);
			this.Controls.Add(this.uxVodeciBrojDepozitneIstitucijeLabel);
			//this.uxTableLayoutPanel.Controls.Add(this.uxVodeciBrojDepozitneIstitucijeLabel);			
			//
			// uxVodeciBrojDepozitneIstitucije
			//
			//this.uxTableLayoutPanel.Controls.Add(this.uxVodeciBrojDepozitneIstitucije);
			this.uxVodeciBrojDepozitneIstitucije.Location = new System.Drawing.Point(160, 52);
			this.Controls.Add(this.uxVodeciBrojDepozitneIstitucije);
			//
			// uxIDMjestoLabel
			//
			this.uxIDMjestoLabel.Text = "IDMjesto:";
			this.uxIDMjestoLabel.Location = new System.Drawing.Point(3, 78);
			this.Controls.Add(this.uxIDMjestoLabel);
			//this.uxTableLayoutPanel.Controls.Add(this.uxIDMjestoLabel);			
			//
			// uxIDMjesto
			//
			//this.uxTableLayoutPanel.Controls.Add(this.uxIDMjesto);
			this.uxIDMjesto.Location = new System.Drawing.Point(160, 78);
			this.Controls.Add(this.uxIDMjesto);
			//
			// uxMBLabel
			//
			this.uxMBLabel.Text = "MB:";
			this.uxMBLabel.Location = new System.Drawing.Point(3, 104);
			this.Controls.Add(this.uxMBLabel);
			//this.uxTableLayoutPanel.Controls.Add(this.uxMBLabel);			
			//
			// uxMB
			//
			this.uxMB.Width = 250;
			this.uxMB.MaxLength = 50;
			//this.uxTableLayoutPanel.Controls.Add(this.uxMB);
			this.uxMB.Location = new System.Drawing.Point(160, 104);
			this.Controls.Add(this.uxMB);
			//
			// uxMinimalniIznosLabel
			//
			this.uxMinimalniIznosLabel.Text = "MinimalniIznos:";
			this.uxMinimalniIznosLabel.Location = new System.Drawing.Point(3, 130);
			this.Controls.Add(this.uxMinimalniIznosLabel);
			//this.uxTableLayoutPanel.Controls.Add(this.uxMinimalniIznosLabel);			
			//
			// uxMinimalniIznos
			//
			//this.uxTableLayoutPanel.Controls.Add(this.uxMinimalniIznos);
			this.uxMinimalniIznos.Location = new System.Drawing.Point(160, 130);
			this.Controls.Add(this.uxMinimalniIznos);
			//
			// uxMaksimalniIznosLabel
			//
			this.uxMaksimalniIznosLabel.Text = "MaksimalniIznos:";
			this.uxMaksimalniIznosLabel.Location = new System.Drawing.Point(3, 156);
			this.Controls.Add(this.uxMaksimalniIznosLabel);
			//this.uxTableLayoutPanel.Controls.Add(this.uxMaksimalniIznosLabel);			
			//
			// uxMaksimalniIznos
			//
			//this.uxTableLayoutPanel.Controls.Add(this.uxMaksimalniIznos);
			this.uxMaksimalniIznos.Location = new System.Drawing.Point(160, 156);
			this.Controls.Add(this.uxMaksimalniIznos);
			//
			// uxMaksimalniBrojRataLabel
			//
			this.uxMaksimalniBrojRataLabel.Text = "MaksimalniBrojRata:";
			this.uxMaksimalniBrojRataLabel.Location = new System.Drawing.Point(3, 182);
			this.Controls.Add(this.uxMaksimalniBrojRataLabel);
			//this.uxTableLayoutPanel.Controls.Add(this.uxMaksimalniBrojRataLabel);			
			//
			// uxMaksimalniBrojRata
			//
			//this.uxTableLayoutPanel.Controls.Add(this.uxMaksimalniBrojRata);
			this.uxMaksimalniBrojRata.Location = new System.Drawing.Point(160, 182);
			this.Controls.Add(this.uxMaksimalniBrojRata);
			//
			// uxIDMjesto
			//				
			this.uxIDMjesto.DisplayMember = "Naziv";	
			this.uxIDMjesto.ValueMember = "ID";	
			// 
			// BankaEditControlBase
			// 
			this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
			this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
			//this.Controls.Add(this.uxTableLayoutPanel);
			this.AutoScroll = true;
			this.Name = "BankaEditControlBase";
			this.Size = new System.Drawing.Size(478, 311);
			//this.Localizable = true;
			((System.ComponentModel.ISupportInitialize)(this.uxErrorProvider)).EndInit();
			((System.ComponentModel.ISupportInitialize)(this.uxBindingSource)).EndInit();			
			this.ResumeLayout(false);
			this.PerformLayout();
		}
		#endregion
				
		#region ComboBox List
		
				
		private Entities.TList<Entities.Mjesto> _IDMjestoList;
		
		/// <summary>
		/// The ComboBox associated with the IDMjesto property.
		/// </summary>
		[System.ComponentModel.Category("ComboBox BindingSources")]
		public Entities.TList<Entities.Mjesto> IDMjestoList
		{
			get {return _IDMjestoList;}
			set 
			{
				this._IDMjestoList = value;
				this.uxIDMjesto.DataSource = null;
				this.uxIDMjesto.DataSource = value;
			}
		}
		
		private bool _allowNewItemInIDMjestoList;
		
		/// <summary>
		/// Indicates if the ComboBox associated with the IDMjesto property allow user to add item.
		/// </summary>
		[System.ComponentModel.Category(".netTiers"), System.ComponentModel.Description("Indicates if end user can add a new item in the combobox. an event will be thrown then.")]
		public bool AllowNewItemInIDMjestoList
		{
			get { return _allowNewItemInIDMjestoList;}
			set
			{
				this._allowNewItemInIDMjestoList = value;
				this.uxIDMjesto.DropDownStyle = value ? System.Windows.Forms.ComboBoxStyle.DropDown : System.Windows.Forms.ComboBoxStyle.DropDownList;
			}
		}
		
		
		#endregion
		
		/// <summary> 
		/// Required designer variable.
		/// </summary>
		private System.ComponentModel.IContainer components = null;

		/// <summary> 
		/// Clean up any resources being used.
		/// </summary>
		/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
		protected override void Dispose(bool disposing)
		{
			if (disposing && (components != null))
			{
				components.Dispose();
			}
			base.Dispose(disposing);
		}
	}
}
